<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>复合选择器的示例</title>
<style type="text/css">
	.default{
		border:1px solid #003a75;
		background-color:yellow;
		margin:5px; 
		width:90px;
		float:left;
		font-size:12px;
		padding:5px;
	}
	.change{
		background-color:#C50210;
		color:#FFF;
	}
</style>

<script type="text/javascript" src="../js/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	$("input[type=button]").click(function(){ //绑定按钮的单击事件
		$("div,#span").addClass("change");    //添加所使用的CSS类
	});
});
</script>

</head>

<body>
<p class="default">p元素</p>
<div class="default">div元素</div>
<span class="default" id="span">ID为span的元素</span>
<input type="button" value="为div元素和ID为span的元素换肤" />
</body>
</html>
